<?php
/**
 * 商品标签，由 Panx 定义，用来根据肤质数据推荐关联商品
 *
 * @author Zeon <scplay@gmail.com>
 * @date 2018/6/7
 * @copyright PanxSoft Inc.
 */
namespace App\Models\Panx;

use App\Models\Panx\Tags\SkinDetectionItem;
use App\Models\Store\WaxSkinRecord;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

/**
 * Class ProductTag
 *
 * @property string $const
 * @property string $name
 *
 * @mixin Builder
 */
class ProductTag extends Model
{
    protected $table = 'product_tags';

    protected $guarded = [];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function products()
    {
        return $this->belongsToMany(Product::class, 'product_pivot_tag', 'product_tag_id', 'product_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function skinDetectionItems()
    {
        return $this->belongsToMany(SkinDetectionItem::class, 'product_tag_pivot_skin_detection_item', 'product_tag_id', 'skin_detection_item_id');
    }
}
